package com.itheima.testJDK8;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class Test4JDK8Date {
    public static void main(String[] args) {
        //创建LocalDateTime时间对象
        LocalDateTime localDateTime = LocalDateTime.of(2021, 12, 12, 23, 12, 34);
        //转换成LocalDate时间对象
        LocalDate localDate = localDateTime.toLocalDate();
        System.out.println(localDate);//2021-12-12
        //转换成LocalTime时间对象
        LocalTime localTime = localDateTime.toLocalTime();
        System.out.println(localTime);//23:12:34
    }
}


